<?php

/**
 * Practica form base class.
 *
 * @method Practica getObject() Returns the current form's model object
 *
 * @package    gnlab
 * @subpackage form
 * @author     Miguel Barocchi
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePracticaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'nombre'           => new sfWidgetFormInputText(),
      'codigo'           => new sfWidgetFormInputText(),
      'hits'             => new sfWidgetFormInputText(),
      'grupo'            => new sfWidgetFormInputText(),
      'unidad_resultado' => new sfWidgetFormInputText(),
      'valor_defecto'    => new sfWidgetFormInputText(),
      'referencia'       => new sfWidgetFormInputText(),
      'otros'            => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nombre'           => new sfValidatorString(array('max_length' => 255)),
      'codigo'           => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'hits'             => new sfValidatorInteger(array('required' => false)),
      'grupo'            => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'unidad_resultado' => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'valor_defecto'    => new sfValidatorString(array('max_length' => 31, 'required' => false)),
      'referencia'       => new sfValidatorString(array('max_length' => 63, 'required' => false)),
      'otros'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('practica[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Practica';
  }

}
